package org.basket.core;

import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

/*
 * BasketUser [kind:"BasketUser", id:"email"][name: "user name"]
 */
public class BasketUser implements EntityAtom {
	public static final String KIND = "BasketUser";
	public static final String NAME = "name";

	private final String id;// email
	private final String name; // user name

	public BasketUser(String email, String name) {
		id = email.toLowerCase();
		this.name = name;
	}

	public Entity getEntity() {
		Key key = KeyFactory.createKey(KIND, id);
		Entity entity = new Entity(key);
		entity.setProperty(NAME, name);
		return entity;
	}
}
